home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / distutils / dep_util.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  2KB  |  61 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. __revision__ = '$Id: dep_util.py 37828 2004-11-10 22:23:15Z loewis $'
  5. import os
  6. from distutils.errors import DistutilsFileError
  7.  
  8. def newer(source, target):
  9.     if not os.path.exists(source):
  10.         raise DistutilsFileError, "file '%s' does not exist" % source
  11.     
  12.     if not os.path.exists(target):
  13.         return 1
  14.     
  15.     ST_MTIME = ST_MTIME
  16.     import stat
  17.     mtime1 = os.stat(source)[ST_MTIME]
  18.     mtime2 = os.stat(target)[ST_MTIME]
  19.     return mtime1 > mtime2
  20.  
  21.  
  22. def newer_pairwise(sources, targets):
  23.     if len(sources) != len(targets):
  24.         raise ValueError, "'sources' and 'targets' must be same length"
  25.     
  26.     n_sources = []
  27.     n_targets = []
  28.     for i in range(len(sources)):
  29.         if newer(sources[i], targets[i]):
  30.             n_sources.append(sources[i])
  31.             n_targets.append(targets[i])
  32.             continue
  33.     
  34.     return (n_sources, n_targets)
  35.  
  36.  
  37. def newer_group(sources, target, missing = 'error'):
  38.     if not os.path.exists(target):
  39.         return 1
  40.     
  41.     ST_MTIME = ST_MTIME
  42.     import stat
  43.     target_mtime = os.stat(target)[ST_MTIME]
  44.     for source in sources:
  45.         if not os.path.exists(source):
  46.             if missing == 'error':
  47.                 pass
  48.             elif missing == 'ignore':
  49.                 continue
  50.             elif missing == 'newer':
  51.                 return 1
  52.             
  53.         
  54.         source_mtime = os.stat(source)[ST_MTIME]
  55.         if source_mtime > target_mtime:
  56.             return 1
  57.             continue
  58.     else:
  59.         return 0
  60.  
  61.